﻿@model CC.Models.clsAccident
@{string vehicles="";
  if (Model.Vehicles!=null){
	  foreach (CC.Models.AccidentVehicles vehicle in Model.Vehicles) { vehicles += "{\"iD\":" + vehicle.ID + ",\"title\":\""+ vehicle.Title + "\"},"; }
	  vehicles = vehicles.TrimEnd(',');  
  }
 }
@if (@Model.NewRec == 1) { <h2 style="margin: 15px; display: inline-block">Naujo įvykio registravimas</h2>}
else {<h2 style="margin: 15px; display: inline-block">Įvykis Nr. @Model.Accident.No</h2>}
<a id="btnReturnToAccidents" class="link-back" href="javascript:void(0);return false;">(atgal į įvykių sąrašą)</a>
<div id="accidentTab">
<ul id='ulWhiteMenu' class='ulWhiteMenu'>
	<li><a href="#AccidentForm">
		<span>Įvykio informacija</span></a></li>
	<li><a href="#AccDocs">
		<span>Įvykio dokumentai</span></a></li>
</ul>
<div id="AccidentForm" class="js-frm whiteTab container" data-ctrl=
	@{if (Model.NewRec == 1) {
		  <text>'{"NewRec":1,"Source":"tblAccidents","tblUpdate":"tblAccidents"}'</text>
	  }
	  else {
		  <text>'{"NewRec":0,"Source":"tblAccidents","vehicles":[@vehicles],
		  "id":@Model.Accident.ID,"Lat":"@Model.Accident.Lat.ToString().Replace(",", ".")","Lng":"@Model.Accident.Lng.ToString().Replace(",", ".")"}'</text>
	  }}
	>
	<div class='left border w47pr_mp ui-corner-all'>
    
		@{if (Model.NewRec == 1) {
			<div class="row">
				<div class='ExtendIt col five' data-ctrl='{"Field":"AccidentTypeID","id":"lstAccidentTypes","labelType":"Top"}'></div>
				<div class='ExtendIt col seven date-time-select' data-ctrl='{"Field":"Date","id":"Date","labelType":"Top", "Type":"DateTimeLess","Default":"Today", "classes":{"input":"w70prImportant"}, "Plugin":{"datepicker":{"minDate":"-3y","maxDate":"0"}}}'></div>
         	</div>

			<div class='ExtendIt row' data-ctrl='{"Field":"ShortNote","id":"ShortNote","labelType":"Top"}'></div>
			
			<div class="row">
				<div class='ExtendIt col seven' data-ctrl='{"Field":"DriverID","id":"lstDrivers","labelType":"Top","List":{"ListType": "None","Editable":{"EditThis": true}}}'></div>
			</div><!-- -->

			<div class="row">
				<div class='ExtendIt col five' data-ctrl='{"Field":"IsNotOurFault","id":"IsNotOurFault","labelType":"Top"}'></div>
				<div class='ExtendIt col seven' data-ctrl='{"Field":"IsOtherParticipants","id":"IsOtherParticipants","labelType":"Top"}'></div>
			</div>

			<div class='ExtendIt' data-ctrl='{"Field":"LongNote","classes":{"input":"row"},"id":"LongNote","labelType":"Top"}'></div>
			<br/>
	 }
	 else {
			<div class="row">
				<div class='ExtendIt col five' data-ctrl='{"Value":@Model.Accident.AccidentTypeID, "Field":"AccidentTypeID","id":"lstAccidentTypes","labelType":"Top"}'></div>
				<div class='ExtendIt col seven date-time-select' data-ctrl='{"Value":"@Model.Accident.Date", "Field":"Date","id":"Date","labelType":"Top","Type":"DateTimeLess", "classes":{"input":"w70prImportant"}, "Default":"Today","Plugin":{"datepicker":{"minDate":"-3y","maxDate":"0"}}}'></div>
			</div>

			<div class='ExtendIt row' data-ctrl='{"Value":"@Model.Accident.ShortNote", "Field":"ShortNote","id":"ShortNote","labelType":"Top"}'></div>
			
			<div class="row">
				<div class='ExtendIt col seven' data-ctrl='{"Value":@Model.Accident.DriverID, "Field":"DriverID","id":"lstDrivers","labelType":"Top", "List":{"ListType": "None","Editable":{"EditThis": true}}}'></div>
			</div><!-- row -->

			<div class="row">
				<div class='ExtendIt col five' data-ctrl='{"Value":"@Model.Accident.IsNotOurFault", "Field":"IsNotOurFault","id":"IsNotOurFault","labelType":"Top"}'></div>
				<div class='ExtendIt col seven' data-ctrl='{"Value":"@Model.Accident.IsOtherParticipants", "Field":"IsOtherParticipants","id":"IsOtherParticipants","labelType":"Top"}'></div>
			</div>

			<div class='ExtendIt' data-ctrl='{"Value":"@Model.Accident.LongNote", "Field":"LongNote","classes":{"input":"row"},"id":"LongNote","labelType":"Top"}'></div>
			<br/>
	 }
		}
		<div class="container">
			@{if (Model.NewRec != 1) {<div class="left mini"><button id="btnDeleteAccident" class="btn-delete"></button></div>}}
			<div class="pull-right links-group">
				<button id="btnSaveAccident" class="btn btnSave">Išsaugoti</button>	
				<a id="btnCancel" href="javascript:void(0);return false;">Atšaukti</a>
			</div>
		</div>
		</div>

	<div class='right w47pr_m' style="position:relative">
	@*---------------------------------------------------------------*@
		<div id='divMapHead' @{if (Model.NewRec == 1) {<text>class="hidden"</text>}}>
			<div class='box_3pr_p border radius-top4 clearfix'>
				<div class='dialog-form-label'>Įvykio vieta:</div>
				@{if (Model.NewRec == 1) {
					
					<div class="bold font16" id='txtPlace'>Nurodykite spragtelėjimu žemėlapyje..</div>

					<div class="clearfix">
						<a class="col three" id="btnEditMap" data-caption="Change">Keisti</a>
						<a class="col five last" id="linkToGoogle" target='_blank' >Nuoroda į Google Žemėlapį</a>
					</div>

				}
		else {
					
					<div class="bold font16" id='txtPlace'>@Model.Accident.LocationAddress, @Model.Accident.LocationDistrict, @Model.Accident.LocationCountry</div>
					
					<div class="clearfix">
						<a class="col three" id="btnEditMap" data-caption="Change">Keisti</a>
						<a class="col five last" id="linkToGoogle" target='_blank' >Nuoroda į Google Žemėlapį</a>
					</div>
		}}
			</div>
		</div>

		<div id='divSearchMap' class="box">	@*	@{if (Model.NewRec != 1) {<text>hidden</text>}}		*@			 
			<h4>Surasti vietovardį arba koordinates:</h4>
			<div class="clearfix">
				<input type='text' id='inputChooseTown' placeholder="Įveskite gyvenvietę parodyti žemėlapyje.." class='col eight text ui-widget-content defaultText defaultTextActive' />
				<a id="btnMapTown" class="col two">Rodyti</a>
				@{if (Model.NewRec == 0) {<a id="cancelMap" class="col two font-s13" >Atšaukti</a>}}
			</div>
		</div>
		<div id='divMap' class="ui-corner-bottom;">map</div>

	@*---------------------------------------------------------------*@
	</div>
</div>
<div id="AccDocs" class="whiteTab"  data-ctrl='{"id":0}'>
	<div id="uploadDocsToAccident" style="margin:0 auto;"></div>
	<div class="cont" style="background:#ffffff;width:100%;border:0;border-top:1px solid;padding-top:1px;"></div>
</div>
</div>
